//% color="#e7a220" iconWidth=50 iconHeight=40
namespace cnn{

    //% block="初始化VEML7700传感器模块" blockType="command" 
    export function feat_init(parameter: any, block: any){

        Generator.addImport("import time");
        Generator.addImport("import sys");
        Generator.addImport("from DFRobot_VEML7700 import *");
        Generator.addCode(`veml7700 = DFRobot_VEML7700_I2C(bus_num = 0)`)
        Generator.addCode(`  
while (veml7700.begin() == False):
    print("Sensor initialize failed!!")
    time.sleep(3)`);


    }

    
    //% block="获取传感器的光照强度读数" blockType="reporter"
    export function mod_load(parameter: any, block: any){
        Generator.addCode(`veml7700.get_ALS_lux()`)
    }


}